// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import '../src/assets/css/global.css'

import {
    Input,
    Form,
    FormItem,
    Button,
    Message,
    Container,
    Header,
    Aside,
    Main,
    Menu,
    MenuItem,
    Submenu,
    Breadcrumb,
    BreadcrumbItem,
    Card,
    Row,
    Col,
    Select,
    Option,
    Dialog,
    Table,
    TableColumn,
    MessageBox,
    Pagination,
    DatePicker,
    Upload,
    Image,
    Switch,
    Tag,
    Divider,
    Carousel,
    CarouselItem,
    Transfer,
    CheckboxGroup,
    CheckboxButton,
    Collapse,
    CollapseItem,
    Link
} from 'element-ui'
Vue.use(Link)
Vue.use(CollapseItem)
Vue.use(Collapse)
Vue.use(CheckboxButton)
Vue.use(CheckboxGroup)
Vue.use(Transfer)
Vue.use(CarouselItem)
Vue.use(Carousel)
Vue.use(Divider)
Vue.use(Tag)
Vue.use(Switch)
Vue.use(Image)
Vue.use(Upload)
Vue.use(DatePicker)
Vue.use(Pagination)
Vue.use(TableColumn)
Vue.use(Table)
Vue.use(Dialog)
Vue.use(Option)
Vue.use(Select)
Vue.use(Input)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Button)
Vue.use(Container)
Vue.use(Header)
Vue.use(Aside)
Vue.use(Main)
Vue.use(Menu)
Vue.use(MenuItem)
Vue.use(Submenu)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Card)
Vue.use(Row)
Vue.use(Col)

Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm

import axios from 'axios'
// 配置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:8000/api/'
Vue.prototype.$http = axios

// 定义主机地址，方便上传文件引用
const serverURL = 'http://127.0.0.1:8000'
Vue.prototype.serverURL = serverURL
    // axios请求拦截器为request添加认证token信息
axios.interceptors.request.use(config => {
    config.headers.Authorization = window.sessionStorage.getItem('token')
        // console.log(config)
    return config
})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
})